<?php TPL::output('mobile/header.tpl.htm'); ?>

<div class="contents">
	<div style=" margin:14px 12px;">
		<?php if ($this->question_info['category_info']['title']) { ?>
		<div class=" triangle-left"></div>
		<a href="mobile/explore/category-<?php echo $this->question_info['category_info']['id']; ?>">
		<div class="sort"><?php echo $this->question_info['category_info']['title']; ?></div>
		</a>
		<?php } ?>
		<?php foreach($this->question_topics as $key => $val) { ?>
		<a href="mobile/topic/<?php echo $val['url_token']; ?>" class="tag" style="margin-top:3px;"><?php echo $val['topic_title']; ?></span></a>
		<?php } ?>
		<div class="c"></div>
	</div>
	<div class="que">
		<div class="">
			<?php if ($this->question_info['anonymous'] == 0) { ?>
			<a href="mobile/people/<?php echo $this->question_info['user_info']['url_token']; ?>"><img class="photo" src="<?php echo get_avatar_url($this->question_info['published_uid'], 'mid'); ?>" / width="25" height="25"></a>
			<?php } ?>
			<font style="font-weight:bold;"><?php echo $this->question_info['question_content']; ?></font>
		</div>
		<div class="con"><?php echo $this->question_info['question_detail']; ?>
			<div >
				<?php if ($this->user_id != $this->question_info['published_uid'] AND $this->user_id) { ?>
				<div class="sub<?php if ($this->question_focus) { ?> cur<?php } ?>" onclick="focus_question($(this), $(this), <?php echo $this->question_info['question_id']; ?>);">
					<?php if ($this->question_focus) { ?>取消<?php } ?>关注</div>
				<?php } ?>
				<div class="time"><?php echo date_friendly($this->question_info['add_time']); ?>&nbsp;&nbsp;<span class="review" onclick="mobile_comments(<?php echo $this->question_info['question_id']; ?>, 'question', $(this)); return false;"><?php echo $this->question_info['comment_count']; ?>条评论</span> 
				</div>
				
				<div class="reply" id="question_comments_<?php echo $this->question_info['question_id']; ?>" style="display:none">
				
				<form action="question/ajax/save_question_comment/question_id-<?php echo $this->question_info['question_id']; ?>" onsubmit="return false;" method="post">
				<div name="comments_list"></div>
       	         <?php if ($this->user_id) { ?>
					<div class="myreply">
							<div style="margin-right:22px;">
								<input class="mainre" type="text" name="message" style="font-size:14px;"  placeholder="输入评论" />
							</div>
							<div class="resub" style="  margin-bottom:12px;" onclick="mobile_ajax_post($(this).parents('div.reply').find('form'), _comments_form_processer); $(this).parents('div.reply').find('form [name=message]').val('');">确定</div>
							
						</div>
				<?php } ?>
				</form>
				</div>
				
			</div>
		</div>
	</div>
	<div class="re">
		<div class="head">
			<?php if ($this->user_id AND $_GET['column'] != 'log') { ?>
			<div style="float:right;">
				<a href="mobile/question/id-<?php echo $this->question_id; ?>__sort_key-agree_count"<?php if ((!$_GET['uid'] && !$_GET['sort_key']) || $_GET['sort_key'] == 'agree_count') { ?> class="cur"<?php } ?>>按票数</a>
				•
				<a href="mobile/question/id-<?php echo $this->question_id; ?>__sort_key-add_time"<?php if ($_GET['sort_key'] == 'add_time') { ?> class="cur"<?php } ?>>按时间</a>
			</div>
			<?php } ?>
			<?php echo $this->answer_count; ?> 个回复 </div>
		<?php if ($this->answers) { foreach ($this->answers AS $key => $val) { ?>
		<div class="answer<?php if ($this->question_info['best_answer'] == $val['answer_id']) { ?> ba<?php } ?>">
			<?php if ($this->question_info['best_answer'] == $val['answer_id']) { ?>
			<div class="best_p">最佳答案</div>
			<?php } ?>
			<!--<div class="vote">
				<?php if ($this->user_id AND $this->user_id != $val['uid']) { ?>
				<a name="<?php echo $val['answer_id']; ?>" status="<?php echo $val['agree_status']; ?>"></a>
				<a data-id="<?php echo $val['answer_id']; ?>" onclick="$.I.addCast(this, G_USER_NAME, '<?php echo $val['answer_id']; ?>')" href="javascript:;" class="s_zt i_prl<?php if ($val['agree_status'] == '1') { ?> s_cur_z<?php } ?>">
				<div class="good" >
					<div class="up">&nbsp;</div>
				</div>
				</a>
				<div class="num" ><span name="agree_num" class="agree_num"><?php echo $val['agree_count']; ?></span>
				</div>
				<a  onclick="$.I.oppCast(this,G_USER_NAME,'<?php echo $val['answer_id']; ?>')" href="javascript:;" class="s_fd i_prl<?php if ($val['agree_status'] == '-1') { ?> s_cur_f<?php } ?>">
				<div class="good" >
					<div class="down">&nbsp;</div>
				</div>
				</a>
				<?php } else { ?>
				<a name="<?php echo $val['answer_id']; ?>" status="<?php echo $val['agree_status']; ?>"></a>
				<a class="default_num defa_agree prohibit_up" href="javascript:;">
				<div class="nologin" >
					<div class="up">&nbsp;</div>
				</div>
				</a>
				<div class="num" ><span name="agree_num" class="agree_num"><?php echo $val['agree_count']; ?></span>
				</div>
				<a class="default_num defa_oppose prohibit_down " href="javascript:;">
				<div class="nologin" >
					<div class="down">&nbsp;</div>
				</div>
				</a>
				<?php } ?>
			</div>-->
			<div class=" txt">
				<div  style=" " >
					<?php if ($val['anonymous']) { ?>
					<span class="name">匿名用户</span>
					<?php } else { ?>
					<a href="mobile/people/<?php echo $val['url_token']; ?>"><span class="name"><?php echo $val['user_name']; ?></span></a>
					<span class="time">
					<?php if ($val['signature']) { ?>
					，<?php echo $val['signature']; ?>
					<?php } ?>
					</span>
					<?php } ?>
				</div>
				<div class="mt" ><?php echo FORMAT::parse_attachs($val['answer_content']); ?></div>
				<div class="time"   ><?php echo date_friendly($val['add_time']); ?>
					<?php if ($this->user_id){ ?>
					• <span class="review" onclick="mobile_comments(<?php echo $val['answer_id']; ?>, 'answer', $(this)); return false;"><?php echo $val['comment_count']; ?> 条评论</span>
					<?php if ($this->user_id != $val['uid']) { ?>
					 • <span<?php if (!$val['user_rated_thanks']) { ?> onclick="answer_user_rate(<?php echo $val['answer_id'];?>, 'thanks', this);"<?php } ?>>
					<?php if ($val['user_rated_thanks']) { ?>已<?php } ?>感谢</span>
					 • <span onclick="answer_user_rate(<?php echo $val['answer_id'];?>, 'uninterested', this);">
					<?php if ($val['user_rated_uninterested']) { ?>撤消<?php } ?>没有帮助</span><?php } ?>
				</div>
				
				<div class="reply" id="answer_comments_<?php echo $val['answer_id']; ?>" style="display:none">
				
				<form action="question/ajax/save_answer_comment/answer_id-<?php echo $val['answer_id']; ?>" onsubmit="return false;" method="post">
				<div name="comments_list"></div>
       	         <?php if ($this->user_id) { ?>
					<div class="myreply">
							<div style="margin-right:22px;">
								<input class="mainre" type="text" name="message" style="font-size:14px;"  placeholder="输入评论" />
							</div>
							<div class="resub" style="margin-bottom:12px;" onclick="mobile_ajax_post($(this).parents('div.reply').find('form'), _comments_form_processer); $(this).parents('div.reply').find('form [name=message]').val('');">确定</div>
						
						</div>
				<?php } ?>
				<?php } ?>
				</form>
				</div>
				
				
			</div>
			<div style="clear:both;"></div>
		</div>
        
		<?php } ?>
        <?php echo $this->pagination; ?>
		<?php } ?>
		<div class="myanswer">
			<?php if (!$this->user_id) { ?>
			<p align="center">要查看所有问题和参与问题请先
				<a href="mobile/login/">登录</a>
				</a>
			</p>
			<?php } else if ($this->user_answered) { ?>
			<p align="center">一个问题只能回复一次</p>
			<?php } else if ((get_setting('answer_self_question') == "N") && ($this->user_id == $this->question_info['published_uid'])) { ?>
			<p align="center">不能回复自己发布的问题</p>
			<?php } else { ?>
			<form action="question/ajax/save_answer/" onsubmit="return false;" method="post" id="answer_form">
				<input type="hidden" name="post_hash" value="<?php echo new_post_hash(); ?>" />
				<input type="hidden" name="question_id" value="<?php echo $this->question_id; ?>" />
				<input type="hidden" name="is_mobile" value="true" />
				<div style="padding:12px; margin-right: 12px;">
					<textarea class="txt" style="font-size:14px;" id="answer_content" onKeyPress="default_Search.txtEvent('#question_submit2',event);" class="answer_content" type="text" name="answer_content" />
					</textarea>
				</div>
				<?php if ($this->human_valid) { ?>
				<div class="code">
					<div class="default_aotoNum l"><img id="captcha" onclick="this.src = G_BASE_URL + '/account/captcha/rnd-' + Math.floor(Math.random() * 10000);" title="点击换一张" src="" /></div>
					<script type="text/javascript">$(document).ready(function () { $('#captcha').click(); });</script>
					<input  type="text" class="default_autoCode" name="seccode_verify">
					&nbsp;
					<div style="clear:both;"></div>
				</div>
				<?php } ?>
				<div class="wrong" id="tip_error_message" style="display:none; float:none;"></div>
				<?php if (get_setting('anonymous_enable') == 'Y') { ?>
				<label class="anonymous" >
				<input type="checkbox" name="anonymous" value="1" />
				匿名</label>
				<?php } ?>
				<div class="sub" onclick="mobile_ajax_post($('#answer_form'), _mobile_tips_form_processer); return false;" id="question_submit2">确定</div>
				<div style="clear:both;"></div>
			</form>
			<?php } ?>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
<?php if ($this->redirect_message) { ?>
$(document).ready(function () {
	<?php foreach ($this->redirect_message AS $key => $message) { ?>
		mobile_header_message('<?php echo $message; ?>');
	<?php } ?>
});
<?php } ?>
</script>
<?php TPL::output('mobile/footer.tpl.htm'); ?>
